﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Test001;

namespace DogJson
{
    public class Test001class
    {

        static DateTime da = DateTime.Now;

        public static void Run()
        {
            Class1.Start();

            long k = -0x3FA4B4CDE;
            Console.WriteLine(k);
            
            Console.WriteLine(Class1.StringToNumber("  - 0x3FA4B4CDE"));
            Console.WriteLine(Class1.StringToNumber("  - 0x3FA4B4CDE"));
            Console.WriteLine(Class1.StringToNumber("12ertrt"));


            Console.WriteLine(Class1.StringToNumber(" -123456789"));
            Console.WriteLine(Class1.StringToNumber("  3.489741"));
            Console.WriteLine(Class1.StringToNumber("3.4164E-05"));
            Console.WriteLine(Class1.StringToNumber("  3.4164E-05"));


            Console.WriteLine(Class1.StringToDouble("  3.489741"));
            Console.WriteLine(Class1.StringToDouble("3.4164E-05"));
            Console.WriteLine(Class1.StringToDouble("  3.4164E-05"));
            Console.WriteLine(Class1.StringToDouble("  3.4164E+105"));
            Console.WriteLine(Class1.StringToDouble("  3.4164e+105"));
            Console.WriteLine(Class1.StringToDouble("  3.41643e-05"));


            Console.WriteLine(Class1.StringToLong("  - 0x3FA4B4CDE"));
            Console.WriteLine(Class1.StringToLong("  - 0x3FA4B4CDE"));
            Console.WriteLine(Class1.StringToLong("1324"));
            Console.WriteLine(Class1.StringToLong(" -123456789"));
            Console.WriteLine(Class1.StringToLong("   -  123456789"));



            double vdouble = 0;
            long vlong = 0;
            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                vlong = long.Parse("-123456789");
            }
            Console.WriteLine("long.Parse: " + (DateTime.Now - da));


            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                vdouble = double.Parse("-3.4164E+105");
            }
            Console.WriteLine("double.Parse: " + (DateTime.Now - da));


            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                vlong = Class1.StringToLong("-123456789");
            }
            Console.WriteLine("Class1.StringToLong: " + (DateTime.Now - da));



            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                vdouble = Class1.StringToDouble("-3.4164E+105");
            }
            Console.WriteLine("Class1.StringToDouble: " + (DateTime.Now - da));



            object v;
            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                v = Class1.StringToNumber("-123456789");
            }
            Console.WriteLine("Class1.StringToNumber Long: " + (DateTime.Now - da));


            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                v = Class1.StringToNumber("-3.4164E+105");
            }
            Console.WriteLine("Class1.StringToNumber Double: " + (DateTime.Now - da));


            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                vlong = Class1.StringToLongStrict("-123456789");
            }
            Console.WriteLine("Class1.StringToLongStrict: " + (DateTime.Now - da));


            da = DateTime.Now;
            for (int i = 0; i < 10000000; i++)
            {
                vdouble = Class1.StringToDoubleStrict("-3.414464E+105");
            }
            Console.WriteLine("Class1.StringToDoubleStrict: " + (DateTime.Now - da));


            


            Console.WriteLine(k);
            Console.WriteLine(Class1.StringToNumber("-0x3FA4B4CDE"));
            Console.WriteLine(Class1.StringToNumber("-0x{3FA4B4CDE"));
        }




    }
}
